<?php
 /**
 * Example Application
 * @package Example-application
 */
@ini_set('display_errors',1);
ini_set("memory_limit",-1);
error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_WARNING));
require('lib/smarty/Smarty.class.php');
require('lib/functions.php');
require('lib/mySQL.php');
require('lib/public_page_class.php');
require('lib/upload.class.php');
require('configs/config.php');
require("lib/json.php");
header("Content-type: text/html; charset=utf-8");
include "data.php";
session_start();
$CONF['page_size'] = 15;                  //每页多少条记录
$CONF['upload_path'] = "../img/";         //图片保存路径
$CONF['upload_maxSize'] = "1024"; //1m;   //上传图片大小限制
$CONF['ad_url'] = ""; //推广链接地址前缀
$CONF['dbkey'] = "ep[ds@1;~32128z";
$gWeb = new Web();
$INCOME = $gWeb->parse_incoming();
$gAct = $INCOME['act'];
if($gAct!="loginMain")
{
	if(empty($_SESSION['adminUser']) || empty($gAct))
	{
		$gAct = "login";
	}
	else if($_SESSION['adminUser'] && empty($gAct))
	{
		$gAct = "main";
	}
}
 

$gOp = $INCOME['op'];
//$smarty->force_compile = true;
$gSmarty = new Smarty;
$gSmarty->debugging = false;
$gSmarty->caching = false;
$gSmarty->cache_lifetime = 120;
$gPageName=basename($_SERVER['PHP_SELF'],"/");
$DB = new DB;
$DB->info['host'] = $CONF['db_host'];
$DB->info['usr']  = $CONF['db_user'];
$DB->info['pwd']  = $CONF['db_pass'];
$DB->info['db']   = $CONF['db_db'];
$DB->db_connect();
mysql_query("set names utf8");
require('configs/menus.php');
$gCurTime = date("Y-m-d H:i:s");
$GIp =$INCOME['IP_ADDRESS'];
$everyoneAuthSpeical[] = "act=msg";
$everyoneAuthSpeical[] = "act=left";
$everyoneAuthSpeical[] = "act=header";
$everyoneAuthSpeical[] = "act=footer";
$everyoneAuthSpeical[] = "act=login";
$everyoneAuthSpeical[] = "act=right";
$everyoneAuthSpeical[] = "act=index";
$everyoneAuthSpeical[] = "act=logout";
$everyoneAuthSpeical[] = "act=ajax";
$everyoneAuthSpeical[] = "act=down";
$everyoneAuthSpeical[] = "act=loginMain";
//$everyoneAuthSpeical[] = "";
if($_SESSION['adminUser']['auth'])
{
	$isCanView = false;
	foreach($everyoneAuthSpeical as $v)
	{
		if(strpos($_SERVER['QUERY_STRING'],$v)!==false)
		{
			$isCanView = true;
		}
	}
	if(!$isCanView)
	{
		if(!isHaveAuth($CONF['menus'],$_SERVER['QUERY_STRING'],$_SESSION['adminUser']['auth']))
		{
	  		$gWeb->redirect("?act=msg");
		}
	}
}
//require "lib/upload.class.php";
$GJson = new Services_JSON();
header("Content-type: text/html; charset=utf-8");
include "actions/".$gAct.".php";
//$smarty->display('index.tpl');
?>
